package com.itcoon.cloud.framework.ex.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.MessageFormatter;

public class CommonSdkException extends BaseException {

    private static final Logger log = LoggerFactory.getLogger(CommonSdkException.class);

    public CommonSdkException(String localizeMessage, String... args){
        this(localizeMessage, null, args);
    }

    public CommonSdkException(String localizeMessage, Throwable cause, String... args){
        super(cause, localizeMessage != null && args != null && args.length > 0 ? MessageFormatter.arrayFormat(localizeMessage, args).getMessage() :  localizeMessage);
    }

    @Override
    public void log() {
        log.error(super.getMessage(), this);
    }
}
